
AddCSLuaFile( "cl_init.lua" )
AddCSLuaFile( "shared.lua" )

include( 'shared.lua' )

ENT.BlastOff = Sound( "weapons/stinger_fire1.wav" )

function ENT:Initialize()
	
	self.Entity:PhysicsInit( SOLID_NONE )
	self.Entity:SetMoveType( MOVETYPE_NONE )
	self.Entity:SetSolid( SOLID_NONE )
	
	self.Entity:DrawShadow( false )
	
	local phys = self.Entity:GetPhysicsObject()
	
	if ValidEntity( phys ) then
	
		phys:EnableGravity( false )
		phys:Wake()
		
	end
	
	self.Entity:EmitSound( self.BlastOff )
	
	self.Kick = true
	
end

function ENT:SetKick( bool )

	self.Kick = bool

end

function ENT:Think()

	if not ValidEntity( self.Entity:GetOwner() ) or self.Entity:HighEnough() then 
	
		self.Entity:GetOwner():Kill()
	
		if self.Kick and ValidEntity( self.Entity:GetOwner() ) then
		
			self.Entity:GetOwner():Kick( "Sent to the Ban Planet." )
		
		end
	
		self.Entity:Remove()
		
		return
	
	end
	
	self.Entity:GetOwner():SetVelocity( Vector( 0, 0, 200 ) )
	
end

function ENT:HighEnough()

	local tr = util.TraceLine( util.GetPlayerTrace( self.Entity:GetOwner(), Vector(0,0,1) ) )
	
	return tr.Hit and tr.HitPos:Distance( self.Entity:GetPos() ) < 100

end

function ENT:PhysicsCollide( data, physobj )
	
end

function ENT:OnTakeDamage( dmginfo )
	
end

function ENT:Use( ply, caller )

end

function ENT:OnRemove()

	local ed = EffectData()
	ed:SetOrigin( self.Entity:GetPos() )
	util.Effect( "Explosion", ed, true, true )
	
end